<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>获取滚动条位置</title>
    <style>

        .auto {
            width: 200px;
            height: 200px;
            overflow: auto;
        }

    </style>
</head>
<body>
<div class="auto" id="scroll">
    asdasdsdsafd fdsfsd fdsf dsf asdf
    asdasdsdsafd fdsfsd fdsf dsf asdf
    asdasdsdsafd fdsfsd fdsf dsf asdf
    asdasdsdsafd fdsfsd fdsf dsf asdf
    asdasdsdsafd fdsfsd fdsf dsf asdf
    asdasdsdsafd fdsfsd fdsf dsf asdf
    asdasdsdsafd fdsfsd fdsf dsf asdf
    asdasdsdsafd fdsfsd fdsf dsf asdf
    asdasdsdsafd fdsfsd fdsf dsf asdf
    asdasdsdsafd fdsfsd fdsf dsf asdf
</div>
<button id="getHeight">获取滚动条高度</button>
<button id="setHeight">使滚动条到达指定高度</button>
</body>
<script src="../../js/jquery-3.4.1.js"></script>
<script>

    $(function () {
        buttonInit();
    });

    function buttonInit() {
        $('#getHeight').bind("click", function () {
            console.log($('#scroll').scrollTop());
        });

        $('#setHeight').bind("click", function () {
            console.log($('#scroll').animate({scrollTop:100},300));
        });
    }

</script>
</html>